package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.FavoritesMapper;
import com.ruoyi.system.domain.Favorites;
import com.ruoyi.system.service.IFavoritesService;

/**
 * 收藏Service业务层处理
 * 
 * @author xrx
 * @date 2024-05-08
 */
@Service
public class FavoritesServiceImpl implements IFavoritesService 
{
    @Autowired
    private FavoritesMapper favoritesMapper;

    /**
     * 查询收藏
     * 
     * @param id 收藏主键
     * @return 收藏
     */
    @Override
    public Favorites selectFavoritesById(Long id)
    {
        return favoritesMapper.selectFavoritesById(id);
    }

    /**
     * 查询收藏列表
     * 
     * @param favorites 收藏
     * @return 收藏
     */
    @Override
    public List<Favorites> selectFavoritesList(Favorites favorites)
    {
        return favoritesMapper.selectFavoritesList(favorites);
    }

    /**
     * 新增收藏
     * 
     * @param favorites 收藏
     * @return 结果
     */
    @Override
    public int insertFavorites(Favorites favorites)
    {
        favorites.setCreateTime(DateUtils.getNowDate());
        return favoritesMapper.insertFavorites(favorites);
    }

    /**
     * 修改收藏
     * 
     * @param favorites 收藏
     * @return 结果
     */
    @Override
    public int updateFavorites(Favorites favorites)
    {
        return favoritesMapper.updateFavorites(favorites);
    }

    /**
     * 批量删除收藏
     * 
     * @param ids 需要删除的收藏主键
     * @return 结果
     */
    @Override
    public int deleteFavoritesByIds(Long[] ids)
    {
        return favoritesMapper.deleteFavoritesByIds(ids);
    }

    /**
     * 删除收藏信息
     * 
     * @param id 收藏主键
     * @return 结果
     */
    @Override
    public int deleteFavoritesById(Long id)
    {
        return favoritesMapper.deleteFavoritesById(id);
    }
}
